<template>
    <view class="pages fitment-pages">
        <!--<sl-filter :independence="true" :color="titleColor" :themeColor="themeColor" :menuList.sync="menuList" @result="result"></sl-filter>-->
        <hm-filter :menuTop="0" :filterData="menuList" :defaultSelected="defaultSelected" :updateMenuName="true" @confirm="confirm" dataFormat="Object"></hm-filter>
        <room-list :houseList="houseList"></room-list>

        <landlord-bottom-navigation-bar></landlord-bottom-navigation-bar>
    </view>
</template>

<script>
    import landlordBottomNavigationBar from "../../../components/landlord-bottom-navigation-bar";
    // import slFilter from '../../../components/sl-filter/sl-filter';
    import HmFilter from "../../../components/hm-filter";
    import RoomList from './components/RoomList';
    export default {
        name: "index",
        components:{
            landlordBottomNavigationBar,
            // slFilter,
            HmFilter,
            RoomList
        },
        data(){
            return{
                active:'',
                menuList:[
                    {
                        "name":'全部小区',
                        "type": 'radio',
                        "submenu": [{
                            "name": "请选择小区",
                            "submenu": [{
                                "name": "不限",
                                "value": ""
                            }]
                        }]
                    },
                    {
                        "name":'出租状态',
                        "type": 'radio',
                        "submenu": [{
                            "name": "请选择出租状态",
                            "submenu": [{
                                "name": "不限",
                                "value": ""
                            }, {
                                "name": "已租",
                                "value": "2"
                            }, {
                                "name": "未租",
                                "value": "1"
                            }]
                        }]
                    },
                    {
                        "name":'出租类型',
                        "type": 'radio',
                        "submenu": [{
                            "name": "请选择出租类型",
                            "submenu": [{
                                'name': '不限',
                                'value': ""
                            }, {
                                'name': '分散式整租',
                                'value': '3'
                            }, {
                                'name': '分散式合租',
                                'value': '2'
                            }, {
                                'name': '分散式公寓',
                                'value': '1'
                            }]
                        }]
                    },
                    {
                        "name":'更多筛选',
                        "type": 'radio',
                        "submenu": [{
                            "name": "请选择更多筛选",
                            "submenu": [{
                                'name': '不限',
                                'value': ''
                            }]
                        }]
                    },
                ],
                houseList:[],
            };
        },
        onShow(){
            let params = {u_id: uni.getStorageSync('u_id')};
            uni.$u.http.get('/api.php/House/house_list' + uni.$u.queryParams(params),).then(res => {
                this.houseList = res;
                for (let i = 0; i < this.houseList.length; i++) {
                    this.menuList[0].submenu[0].submenu.push({
                        'name': this.houseList[i].s_name,
                        'value': this.houseList[i].s_name
                    });
                }
            });
        },
        methods:{
            confirm(e){
                let params = {
                    u_id: uni.getStorageSync('u_id'),
                    s_name: e.value[0][0][0],
                    rent_type: e.value[1][0][0],
                    type: e.value[2][0][0]
                };

                uni.$u.http.get('/api.php/House/house_list' + uni.$u.queryParams(params),).then(res => {
                    this.houseList = res;
                });
            },
        }
    }
</script>

<style lang="scss" scoped>
    .pages {
        width: 100%;
        min-height: calc(100vh - 44px);
        background-color: RGBA(245, 245, 245, 1);
        margin-top: 44px;
    }
    .content{
    }

    .text {
        margin-top: 50px;
        margin-left: 20px;
        width: 100%;
    }

    .btns{
        width: 22%;
        padding: 0px;
        margin-left: 2px;


    }
    .box{
        display: flex;
        padding: 2px;
        opacity: 0.9;
        color: #fff;
        flex-wrap: wrap;
    }
    .box-an {
        background-color: #999;
        width: 33%;
        /*height: 130px;*/
        padding: 10px;
        margin-right: 1px;
        .house_name{
            width: 60px;
            overflow:hidden;
            white-space:nowrap;
            text-overflow: ellipsis;
        }
    }
    .active{
        background-color: #007aff;
    }
    .is_Show{
        color: #fff;
        padding: 5px 2px;
        background-color: red;
    }
    .show{
        color: #007AFF;
        background-color: #fff;
    }
    .activeType{
        background-color: #36BBFF !important;
    }
</style>